<template>
	<view class="cooperation">
		<view class="box">
			<view class="input">
				<input type="text" v-model="name" placeholder="姓名(必填)"/>
			</view>
			<view class="input">
				<input type="text" v-model="phone" placeholder="联系方式(必填)"/>
			</view>
			<view class="edit">
				<textarea maxlength="1000" v-model="content" placeholder="请说明合作内容(必填)" />
			</view>
			<view class="btn">
				<button type="default" :disabled="isDisplay" @click="submit()">提交</button>
			</view>
		</view>
	</view>
</template>

<script>
	import {cooperation} from "@/api/entrance.js"
	export default{
		name:"cooperation",
		data(){
			return{
				content:"",
				isDisplay:false,
				name:"",
				phone:"",
				content:""
			}
		},
		methods:{
			async submit(){
				if(!this.name){
					this.$msg("请填写姓名")
					return
				}
				if(!this.phone){
					this.$msg("请填写联系方式")
					return
				}
				if(!this.name){
					this.$msg("请填写合作内容")
					return
				}
				let data = {
					name:this.name,
					phone:this.phone,
					content:this.content
				}
				this.isDisplay = true;
				let res = await cooperation(data);
				if(res.code === 1){
					setTimeout(()=>{
						uni.navigateBack()
					},1000)
				}
				this.$msg(res.msg)
			}
		}
	}
</script>

<style scoped lang="less" src="./cooperation.less">
</style>
